<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			div{
				border: #000000 1px solid;
			}
			#d1{
				width: 150px;
				height: 150px;
			}
			#d2{
				width: 100px;
				height: 100px;
			}
			#d3{
				width: 50px;
				height: 50px;
			}
		</style>
	</head>
	<body>
		<!-- div#d1>div#d2>div#d3(快捷键) -->
		<div id="d1">d1
			<div id="d2">d2
				<div id="d3">d3</div>
			</div>
		</div>
		<script type="text/javascript">
			let divs=document.querySelectorAll("div")
			for (let i = 0; i < divs.length; i++) {
				divs[i].addEventListener('click',f1,true)//true表示捕获
				divs[i].addEventListener('click',f2,false)//false表示冒泡型
			}
				function f1(){
				console.log(`捕获型${event.currentTarget.id}正在执行`);
				//event.stopPropagation()
			}
			function f2(){
				console.log(`冒泡型${event.currentTarget.id}正在执行`);
				 event.stopPropagation() //阻止事件继续传播,让原来冒泡型不再进行
			}
			
		</script>
	</body>
</html>
